<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    // 可以使用Set、filter+indexOf、for+includes、双重for循环
    const arr = [1, 1, '1', 17, true, true, false, false, 'true', 'a', {}, {}];
    {
        function duplicateRemoval(arr){
            return [...new Set(arr)]
        }
        console.log(duplicateRemoval(arr))
    }
    {
        function duplicateRemoval(arr){
            return arr.filter((item,index) => arr.indexOf(item) === index)
        }
        console.log(duplicateRemoval(arr))
    }
    {
        function duplicateRemoval(arr){
            const result = []
            for(let i = 0;i < arr.length;i++){
                if (!result.includes(arr[i])){
                    result.push(arr[i])
                }
            }
            return result
        }
        console.log(duplicateRemoval(arr))
    }
    {
        function duplicateRemoval(arr){
            for(let i = 0;i < arr.length;i++){
                for(let j = i + 1;j < arr.length;j++){
                    if (arr[i] === arr[j]){
                        arr.splice(j,1)
                        j--
                    }
                }
            }
            return arr
        }
        console.log(duplicateRemoval(arr))
    }
</script>
</html>
